feat: builder-agnostic architecture, global token infrastructure, Bricks CPT font fix - #171
Conversation
Bricks stores custom uploaded fonts as a CPT (not in the bricks_custom_fonts option). The fonts REST endpoint now calls Bricks\Custom_Fonts::get_custom_fonts() when the class is available, with a WP_Query fallback on BRICKS_DB_CUSTOM_FONTS for edge cases where the class hasn't loaded yet. Both paths feed into the existing deduplication step, so no duplicates appear if a font exists in both storage locations. https://claude.ai/code/session_01DU3r3kT7GqH7w7jeadV2DT
|
Warning Review limit reached
More reviews will be available in 56 minutes and 6 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds custom font collection to the Bricks font REST handler. The ChangesCustom Fonts Integration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@integrations/bricks/includes/class-fonts-rest.php`:
- Around line 132-133: The call to \Bricks\Custom_Fonts::get_custom_fonts() can
fatal if the class exists but the static method is missing or incompatible;
modify the branch that sets $cpt_fonts so it first verifies the method is
callable (e.g. method_exists('Bricks\\Custom_Fonts','get_custom_fonts') or
is_callable(['\\Bricks\\Custom_Fonts','get_custom_fonts'])) before invoking it,
and if not callable fall back to the existing CPT-based path (leave the CPT
logic intact); optionally wrap the call in a try/catch to safely handle runtime
errors from Bricks and ensure $cpt_fonts remains populated via the fallback when
the Bricks API is unavailable or incompatible.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f53d4d18-2700-463d-bdd1-5f3061b50d31
📒 Files selected for processing (1)
integrations/bricks/includes/class-fonts-rest.php
get_custom_fonts() is undocumented/internal in Bricks. Added method_exists() check alongside class_exists() so a missing method doesn't fatal. Wrapped the call in try/catch(\Throwable) so runtime errors from an incompatible Bricks version fall through to the existing WP_Query CPT path instead. https://claude.ai/code/session_01DU3r3kT7GqH7w7jeadV2DT
Summary
includes/—Slashed_Token_Store,Slashed_CSS_Generator,Slashed_CSS_Loader,Slashed_Token_Page, and REST controllers are no longer Bricks-specific; renamed fromSlashed_Bricks_*toSlashed_*, REST namespace changed fromslashed-bricks/v1toslashed/v1Slashed_Core_Enqueueclass inincludes/registers and enqueues theslashed-frameworkstylesheet on every WP site (frontend + block editor), with no builder required; Bricks integration now only adds its dark-mode bridge inline stylesclass-fonts-rest.phpnow callsBricks\Custom_Fonts::get_custom_fonts()to include fonts stored as a CPT (used by current Bricks versions), with aWP_Queryfallback when the class isn't loaded; results feed into existing deduplicationFixes included
class-css-generator.phpandclass-inventory.phpwere callingget_option()directly, bypassing the one-time migration inSlashed_Token_Store::get_settings()delete_settings()now also clears the legacyslashed_bricks_tokensoption so a Reset All before first migration can't leave stale dataclass-token-page.phpusedSLASHED_URLetc. unconditionally; addeddefined()guards withSLASHED_BRICKS_*fallbackshtml_font_sizeoverride was missing fromenqueue_editor()— rem values in the iframed editor canvas now match the public frontendindex.htmlstill referencedwindow.slashedBricksApp; renamed towindow.slashedAppTest plan
slashed-frameworkstylesheet loads on frontend and in block editorhtml_font_sizeto 62.5% — confirm rem override appears in both frontend and block editor canvasslashed/v1REST routesslashed-frameworkloads in the canvas iframe, not in the builder panel chromeslashed_tokensandslashed_bricks_tokensoptions are deletedhttps://claude.ai/code/session_01DU3r3kT7GqH7w7jeadV2DT
Generated by Claude Code
Summary by CodeRabbit